﻿using System;
using System.Text.RegularExpressions;

class HTMLExtracts
{
    static void Main()
    {
        string text = @"<html><head><title>News</title></head><body><p><a href=""http://academy.telerik.com"">TelerikAcademy</a>aims to provide free real-world practicaltraining for young people who want to turn into skillful .NET software engineers.</p></body></html>";

        int sum = 0;

        for (int i = 0; i < text.Length; i++)
        {
            if (text[i] == '<')
            {
                sum++;
                continue;
            }

            if (text[i] == '>')
            {
                sum--;
                continue;
            }

            if (sum == 0)
            {
                Console.Write(text[i]);
                if (text[i + 1] == '<')
                {
                    Console.Write(' ');
                }
            }
        }
    }
}